﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BKH.BLL
{
    class KinhNghiemBUO:IBUO<tbl_Experence>
    {
        HospitalDBDataContext context = new HospitalDBDataContext();
        public bool Insert(tbl_Experence obj)
        {
            try
            {

                context.tbl_Experences.InsertOnSubmit(obj);
                context.SubmitChanges();
                return true;
            }
            catch (Exception)
            {

                return false;
            }
        }

        public bool Delete(int id)
        {
            try
            {
                tbl_Experence item = context.tbl_Experences.Where(n => n.ExperenceID == id).ToList<tbl_Experence>().FirstOrDefault();
                if(item !=null)
                {
                    context.tbl_Experences.DeleteOnSubmit(item);
                    context.SubmitChanges();
                    return true;
                }
                return false;
            }
            catch (Exception)
            {

                return false;
            }
        }

        public bool Delete(tbl_Experence obj)
        {
            throw new NotImplementedException();
        }

        public List<tbl_Experence> GetAll()
        {
            throw new NotImplementedException();
        }

        public tbl_Experence GetSingle(int id)
        {
            throw new NotImplementedException();
        }

        public bool Update(int id, tbl_Experence obj)
        {
            throw new NotImplementedException();
        }
        public List<tbl_Experence> GetALlByID(int Nv)
        {
            return context.tbl_Experences.Where(n => n.Id_Staff == Nv).ToList<tbl_Experence>();
        }

    }
}
